#ifndef KTABLEHEADVIEW_H
#define KTABLEHEADVIEW_H


#include <QObject>
#include <QHeaderView>
#include <QMap>
#include <QCheckBox>

namespace kdk {

/**
 * @brief 继承自QHeaderView，设置view视图标题
 * @since 2.5
 */
class KTableHeaderViewPrivate;

class KTableHeaderView : public QHeaderView
{
    Q_OBJECT
public:
    /**
     * @brief KTableHeaderView 构造函数
     * @param orientation 方向
     * @param parent 父类对象
     */
    KTableHeaderView(Qt::Orientation orientation, QWidget *parent = nullptr);

    /**
     * @brief 设置水平标题
     * @param list
     */
    void setTitle(QStringList list);

    /**
     * @brief 设置menu
     * @param menu
     * @param column
     */
    void setMenu(QMenu *menu,int column);

protected:
    void paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const;
    void mousePressEvent(QMouseEvent *e);
    void mouseReleaseEvent(QMouseEvent *e);
    bool event(QEvent *e);

Q_SIGNALS:
    void checkStateChange(int state);
    void clickedHeader(int column);

public slots:
    void checkStateChangeSlot(int iState);

private:
    Q_DECLARE_PRIVATE(KTableHeaderView)
    KTableHeaderViewPrivate *const d_ptr;

};

}
#endif // KTABLEHEADVIEW_H
